import axios from '@/utils/request'

// 用户登录请求
export const userlogin = (mobile, code) => {
  return axios({
    method: 'POST',
    url: '/v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
}

// 获取用户资料信息
export const getUserInfo = () => {
  return axios({
    url: '/v1_0/user/profile'
  })
}

/**
 * 关注某用户
 */
export function attention(target) {
  return axios({
    url: '/v1_0/user/followings',
    method: 'POST',
    data: {
      target
    }
  })
}

/**
 * 取消关注某用户
 */
export function quattention(target) {
  return axios({
    url: `/v1_0/user/followings/${target}`,
    method: 'DELETE'
  })
}

/**
 * 修改user信息
 * @param {修改信息的参数} data
 * @returns
 */
export function ChangeUserInfo(data) {
  return axios({
    url: '/v1_0/user/profile',
    method: 'PATCH',
    data
  })
}

export function changeimg(fa) {
  return axios({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data: fa
  })
}
